unit dmxt_ModuleCheckConfig;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dmModule, FR_DSet, FR_DBSet, DB, ADODB;

type
  Tdtmxt_ModuleCheckConfig = class(TdtmModule)
    adsDetail: TADODataSet;
    adsModule: TADODataSet;
    adsDetailDetailID: TStringField;
    adsDetailID: TStringField;
    adsDetailOrderID: TIntegerField;
    adsDetailFunID: TIntegerField;
    adsDetailFunName: TStringField;
    adsDetailChineseName: TStringField;
    adsDetailFieldName: TStringField;
    adsDetailCheckMan: TStringField;
    adsDetailCheckManName: TStringField;
    adsDetailWriter: TStringField;
    adsDetailWriteTime: TDateTimeField;
    adsDetailModifier: TStringField;
    adsDetailModifyTime: TDateTimeField;
    adsDetailRemark: TStringField;
    adsBrowseDetail: TADODataSet;
    StringField1: TStringField;
    StringField2: TStringField;
    IntegerField1: TIntegerField;
    IntegerField2: TIntegerField;
    StringField3: TStringField;
    StringField4: TStringField;
    StringField5: TStringField;
    StringField8: TStringField;
    DateTimeField1: TDateTimeField;
    StringField9: TStringField;
    DateTimeField2: TDateTimeField;
    StringField10: TStringField;
    adsMasterEditID: TStringField;
    adsMasterEditModuleID: TIntegerField;
    adsMasterEditSendMan: TStringField;
    adsMasterEditSendManName: TStringField;
    adsMasterEditWriter: TStringField;
    adsMasterEditWriteTime: TDateTimeField;
    adsMasterEditModifier: TStringField;
    adsMasterEditModifyTime: TDateTimeField;
    adsMasterEditRemark: TStringField;
    adsMasterEditres_ModuleName: TStringField;
    adsMasterID: TStringField;
    adsMasterModuleID: TIntegerField;
    adsMasterSendMan: TStringField;
    adsMasterSendManName: TStringField;
    adsMasterWriter: TStringField;
    adsMasterWriteTime: TDateTimeField;
    adsMasterModifier: TStringField;
    adsMasterModifyTime: TDateTimeField;
    adsMasterRemark: TStringField;
    adsMasterModuleNo: TStringField;
    adsMasterModuleName: TStringField;
    adsBrowseDetailCheckMan: TStringField;
    adsBrowseDetailCheckManName: TStringField;
    adsDetailHasDefault: TBooleanField;
    adsBrowseDetailHasDefault: TBooleanField;
    adsMasterEditHasStop: TBooleanField;
    adsMasterEditStoper: TStringField;
    adsMasterEditStopTime: TDateTimeField;
    adsMasterEditStopMemo: TStringField;
    adsMasterHasStop: TBooleanField;
    adsMasterStoper: TStringField;
    adsMasterStopTime: TDateTimeField;
    adsMasterStopMemo: TStringField;
    adsDetailHasStopFun: TBooleanField;
    adsBrowseDetailHasStopFun: TBooleanField;
    adsDetailNextCheckMan: TStringField;
    adsDetailNextCheckManName: TStringField;
    adsBrowseDetailNextCheckMan: TStringField;
    adsBrowseDetailNextCheckManName: TStringField;
    procedure adsDetailNewRecord(DataSet: TDataSet);
    procedure adsMasterEditNewRecord(DataSet: TDataSet);
  private
    { Private declarations }
  protected
    procedure ModuleInit;override;
  public
    { Public declarations }
    FModuleID: string;
    procedure OpenEditDataSet;override;
  end;

var
  dtmxt_ModuleCheckConfig: Tdtmxt_ModuleCheckConfig;

implementation

uses uShare;

{$R *.dfm}

{ Tdtmxt_ModuleCheckConfig }

procedure Tdtmxt_ModuleCheckConfig.ModuleInit;
begin
  inherited;
  FUniqueTable := 'xt_ModuleCheckConfig';
  FMasterKeyField := 'ID';
end;

procedure Tdtmxt_ModuleCheckConfig.OpenEditDataSet;
begin
  FMasterEditTable := 'xt_ModuleCheckConfig';
  FMasterKeyField := 'ID';
  inherited;

end;

procedure Tdtmxt_ModuleCheckConfig.adsDetailNewRecord(DataSet: TDataSet);
begin
  inherited;
  SetWriteInfo(DataSet);
  DataSet.FieldByName('OrderID').ReadOnly := False;
  DataSet.FieldByName('OrderID').AsInteger := DataSet.RecordCount+1;
  DataSet.FieldByName('DetailID').ReadOnly := False;
  DataSet.FieldByName('DetailID').AsString := uShare.GetCurMaxID('da_UseCarApplyDetail', nil, 'ID');
  DataSet.FieldByName('ID').ReadOnly := False;
  DataSet.FieldByName('ID').AsString := adsMasterEdit.FieldByName('ID').AsString;
  DataSet.FieldByName('HasDefault').ReadOnly := False;
  DataSet.FieldByName('HasDefault').AsBoolean := False;
  DataSet.FieldByName('HasStopFun').ReadOnly := False;
  DataSet.FieldByName('HasStopFun').AsBoolean := False;
end;

procedure Tdtmxt_ModuleCheckConfig.adsMasterEditNewRecord(
  DataSet: TDataSet);
begin
  inherited;
  if FModuleID<>'' then
  begin
    DataSet.FieldByName('ModuleID').ReadOnly := False;
    DataSet.FieldByName('ModuleID').AsString := FModuleID;
  end;
  DataSet.FieldByName('HasStop').ReadOnly := False;
  DataSet.FieldByName('HasStop').AsBoolean := False;
end;

end.
